package com.lechuang.user.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lechuang.common.model.BaseEntity;
import com.lechuang.user.dto.UpdateUserDto;
import com.lechuang.user.entity.User;
import com.lechuang.user.service.UserService;
import com.lechuang.user.mapper.UserMapper;
import org.springframework.stereotype.Service;

/**
* @author apple
* @description 针对表【user(用户表)】的数据库操作Service实现
* @createDate 2024-06-21 14:42:10
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{

    @Override
    public User queryByPhone(String phone) {
        User user = this.lambdaQuery()
                .eq(User::getPhone, phone)
                .eq(BaseEntity::getStatus,BaseEntity.STATUS_NORMAL)
                .one();
        return user;
    }

    @Override
    public User queryByInviteCode(String inviteCode) {
        User user = this.lambdaQuery()
                .eq(User::getInviteCode, inviteCode)
                .eq(BaseEntity::getStatus,BaseEntity.STATUS_NORMAL)
                .one();
        return user;
    }
}




